package speed;

public class ConstractUse02 {
	public static void main(String[] args) {
		Dog dog = new Dog("小白", 4);
		Dog dog2 = new Dog("小白", 4);
		boolean compwith = dog.compwith(dog2);
		System.out.println(compwith);
	}
}

class Dog{
	String name;
	int age;
	public Dog(String name, int age) {
		this.name = name;
		this.age = age;
	}
	
	public boolean compwith (Dog dog) {
		return this.age == dog.age&&this.name.equals(dog.name);
		
	}
	
}
